<template>
  <van-row :class="top ? 'chats-cell-top' : '' " v-fb="{cls:'cellActive'}">
    <van-col class="chats-left" span="4">
      <van-image
        class="chats-icon"
        radius="4"
        :show-loading="loading"
        :src="headUrl"
        lazy-load
      />
    </van-col>
    <van-col class="chats-right van-hairline--bottom" span="20">
      <van-row>
        <van-col class="chats-title" span="15">{{title}}</van-col>
        <van-col class="chats-time" span="9">{{time}}</van-col>
      </van-row>
      <van-row>
        <van-col class="chats-message" span="18">{{message}}</van-col>
        <van-col class="chats-mute" span="6" v-show="mute">
          <van-icon class-prefix="iconfont" name="jingyin"/>
        </van-col>
      </van-row>
    </van-col>
  </van-row>
</template>

<script>
  export default {
    name: "ChatCell",
    props: {
      headUrl: {
        type: String,
        default: "https://img01.yzcdn.cn/vant/cat.jpeg"
      },
      title: {
        type: String,
        default: ""
      },
      time: {
        type: String,
        default: ""
      },
      message: {
        type: String,
        default: ""
      },
      mute: {
        type: Boolean,
        default: false
      },
      top: {
        type: Boolean,
        default: false
      }
    },
    data () {
      return {
        loading: false
      }
    },
    methods: {

    }
  }
</script>

<style scoped>
  .chats-cell-top{
    background-color: #fbfbfb;
  }
  .chats-left {
    height: 60px;
    padding: 10px 0 0px 16px;
    line-height: 50px;
  }
  .chats-right {
    height: 60px;
    padding: 10px 0 0px 8px;
  }
  .chats-icon {
    height: 40px;
    width: 40px;
  }
  .chats-title {
    height: 20px;
    font-weight: 500;
    font-size: 16px;
  }
  .chats-mute,.chats-time {
    height: 20px;
    padding-right: 16px;
    line-height: 24px;
    font-size: 10px;
    text-align: right;
    color: #ababab;
  }
  .chats-message {
    padding-top: 4px;
    height: 20px;
    line-height: 20px;
    font-size: 12px;
    text-align: left;
    color: #ababab;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .cellActive {
    background-color: #f2f3f5;
  }
</style>